# pathway reweighted makefile
TASK_DIR:=$(dir $(abspath $(lastword $(MAKEFILE_LIST))))

include ../../config.mk

# Scripts
RMD_FILE := $(TASK_DIR)/src/print_ao_table.Rmd

# Inputs
REG_OUTPUT := $(TASK_DIR)/../../run_regressions/output/regression_output__pathway_reweighted_outcomes.csv
SUBGROUP_OUTPUT := $(TASK_DIR)/../../run_regressions/output/regression_output__by_subgroup.csv

# Outputs
OUT_FILE := $(OUT_DIR)/andrews_oster_table_up_to_date.tex

# Recipe
$(OUT_FILE): $(RMD_FILE) $(REG_OUTPUT) $(SUBGROUP_OUTPUT) $(OUTCOME_LABELS_FILE)
	@mkdir -p $(OUT_DIR)
	@mkdir -p $(PAPER_OUT_DIR)
	$(R_script) -e "rmarkdown::render(input = '$(RMD_FILE)')"
	@cp $(OUT_DIR)/*up_to_date.tex $(PAPER_OUT_DIR)

